package com.neulogistics.contrib.transfercenter.api.application.converter;

import com.neulogistics.contrib.transfercenter.api.application.query.TransferOrderQuery;
import com.neulogistics.contrib.transfercenter.infrastructure.persistence.orm.po.TransferOrderPO;
import org.springframework.beans.BeanUtils;

public class TransferOrderQueryPOConverter {
    public static TransferOrderPO queryToPO(TransferOrderQuery transferOrderQuery){
        if(transferOrderQuery == null){
            return null;
        }

        TransferOrderPO transferOrderPO = new TransferOrderPO();

        BeanUtils.copyProperties(transferOrderQuery, transferOrderPO);

        if(transferOrderQuery.transferStatus == -1){
            transferOrderPO.setTransferStatus(null);
        }

        return transferOrderPO;
    }
}
